package com.panfeng.xcloud.common.core.enums;

/**
 * 响应状态对象
 *
 * @author xiaobo
 * @date 2018-03-15
 */
public enum ResponseStatusEnum {

    OK("200", "成功"),
    ERROR("990", "系统开小差啦"),
    FAIL("991", "操作失败"),
    PARAMETER_ERROR("301", "参数错误"),
    ZUUL_FALL_BACK("303", "{0}无法访问服务，该服务可能由于某种未知原因被关闭，请重启服务！"),
    INTERNAL_ERROR("304", "内部服务异常，异常信息：{0}"),
    UNKNOW_ERROR("305", "未知错误"),
    ANALYSIS_TOKEN_FAIL("401", "解析token失效"),
    UNAUTHORIZED("401", "无访问权限"),
    LOGINTOKEN_REQUEST_FAIL("308", "登录失败"),
    GET_CURRENT_LOGIN_INFO_FAIL("309", "用户不存在"),
    NOT_QUERY_USER_INFO_ERROR("315", "无法查询到当前用户信息"),
    NOT_QUERY_USER_PERSONALINFO_ERROR("317", "未查到用户个人信息"),
    DATA_OPERATE_FAIL("319", "已存在同类型绑定账号,新增账号失败"),
    DATA_NOT_EXIST_OPERATE_FAIL("320", "不存在已绑定账号,重新绑定账号失败"),
    INVALID_TOKEN("401", "access_token无效"),
    NOT_LOGIN_ERROR("401", "访问此资源需要完全的身份验证"),
    AUTH_CODE_FAIL("334", "验证码不正确"),
    LOGIN_AUTHENTICATION_FAILURE("335", "登录验证失败"),
    SENDSMSRATE_FAIL("336", "短信次数校验-操作频率过快"),
    MOBILESMSCOUNT_FAIL("402", "短信次数校验-当天短信发送数上限"),
    IPSMSCOUNT_FAIL("403", "短信次数校验-IP当天短信发送数上限"),
    TOTALSMSCOUNT_FAIL("404", "短信次数校验-当天短信发送数上限"),
    ANTI_CRAWLER_FAIL("410", "由于该网站的robots.txt文件存在限制指令，系统无法提供该页面的内容描述"),
    CURRENT_NULL_REGISTER_CACHE_INFO_FAIL("411", "当前未注册缓存服务内存"),
    MOBILE_AND_EMIAL_PARAMETER_ERROR("414", "手机号或者邮箱不能都不填"),
    MOBILE_FORMAT_PARAMETER_ERROR("415", "填写手机号格式不正确"),
    EMAIL_FORMAT_PARAMETER_ERROR("416", "填写邮箱格式不正确"),
    SIGN_ERROR("421", "当日已签到,不能重复签到"),
    USER_NOT_EXIST("422", "账号不存在"),
    QUERYID_IS_NOT_NULL("423", "查看用户不能为空"),
    REPEAT_RESUBMIT("424", "重复提交"),
    VERIFICATION_ERROR("424", "校验验证码错误"),
    USER_EXIST("425", "账号已存在"),
    INVITE_CODE_ERROR("426", "该邀请码不存在"),
    INTEGRAL_RULE_NOT_EXIST("427", "注册积分规则不存在"),
    NOT_PARAMTER_NULL("428", "参数为空"),
    NICKNAME_ERROR("429", "昵称不能重复，请重新设置"),
    EMAIL_ERROR("430", "邮箱格式不正确"),
    MOBILE_ERROR("431", "手机格式不正确"),
    LOGIN_PWD_ERROR("432", "登录密码格式不正确，设置6-20位字母与数字的组合"),
    TRANS_PWD_ERROR("433", "密码格式不正确"),
    UPDATE_PWD_ERROR("434", "新密码与旧密码一致"),
    TRANSPWD_ERROR("435", "交易密码已存在"),
    USER_ERROR("436", "与当前绑定账号一致"),
    ID_CARD_ERROR("438", "身份证已实名"),
    USER_OCRAUTHCOUNT_ERROR("439", "用户ocr认证次数超过限制3次"),
    GET_APPVERSION_ERROR("440", "获取当前app版本更新配置异常，不存在该客户端类型配置"),
    FOLLOW_ERROR("441", "关注失败"),
    REPEAT_FOLLOW("442", "重复关注"),
    ACCOUNT_FOLLOW_EXIST("443", "跟单账户已存在"),
    GT_ERROR("445", "极验异常"),
    TRADE_UPDATE_USDT_BALANCE_ERROR("454", "更新USDT余额发生异常"),
    ACCOUNT_QUOTA_ERROR("458", "账户余额不足"),
    VERIFYCODE_INPUT_ERROR("463", "验证码输入不正确"),
    LOGIN_USER_IS_NOT_EXIST_ERROR("464", "登录账户不存在"),
    NOT_SUPPORT_LOGIN_MODE_ERROR("465", "不支持该种登录模式"),
    REFRESHTOKEN_OPT_ERROR("466", "刷新token失败"),
    NOT_REGISTER_USER_FAIL("473", "平台未注册该用户"),
    USERFAMILYTREE_LIST_IS_EMPTY_ERROR("474", "当前邀请人的族谱列表信息不存在"),
    USERFAMILYTREE_IS_NOT_EXIST_ERROR("475", "当前邀请人在族谱中不存在"),
    ID_CARD_REGISTERED_ERROR("477", "身份证号码已被注册"),
    CHECK_USER_NOT_EXIST_ERROR("480", "该用户不存在！请核对后重新输入"),
    XD_NOT_SEND_SELF_ERROR("481", "不能转赠给自己"),
    AUTH_NOT_FAIL_ERROR("482", "实名认证不通过"),
    TRANS_PWD_NOT_SETTING_ERROR("483", "未设置交易密码"),
    TRANS_PWD_FOR_SENDXD_ERROR("484", "交易密码错误！请重新输入"),
    USER_DISABLED_FOR_SENDXD_ERROR("485", "用户信息已失效，请联系客服咨询详情"),
    USER_ACCOUNT_EXCEPTION_FOR_SENDXD_ERROR("486", "您的账户状态异常，请联系客服咨询详情"),
    GET_USER_ID_ERROR("488", "分配uid失败"),
    NOT_ALLOW_TRADE("532", "当前有该合约的持仓或挂单，无法发单"),
    USER_PROHIBIT_ERROR("539", "您的账户已被封禁，请联系客服"),
    USER_PWD_INPUT_ERROR("540", "输入的密码错误"),
    NOT_REALNAME("549", "未实名认证"),
    OKEX_PERMISSION_ERROR("554", "秘钥权限有误"),
    OKEX_KEY_ERROR("555", "传入的秘钥信息有误"),
    BINDED_ERROR("556", "同意交易所无法同时绑定发单和跟单"),
    GET_ID_CARD_ERROR("562", "获取用户实名身份信息失败"),
    OCRIDENTITYAUTHENTICATION_NOT_LOCK_ERROR("563", "实名重复操作"),
    OCRCHECKFREQUENCY_REPEAT_RESUBMIT("564", "实名操作太频繁"),
    WALLET_BALANCE_NOT_ENOUGH("567", "点卡余额不足"),
    ASSERTS_INSUFFICIENT("572", "账户资产不足"),
    WITHDRAW_CURRENCY_ERROR("573", "提币失败"),
    GOOGLE_VERIFY_ERROR("575", "没有通过谷歌验证"),
    MOBILE_BINDING_ERROR("576", "没有绑定手机号"),
    POSITION_ERROR("577", "移除币种正在持仓"),
    BINANCE_PERMISSION_ERROR("583", "秘钥权限有误"),
    BINANCE_KEY_ERROR("584", "传入的秘钥信息有误"),
    HUOBI_PERMISSION_ERROR("585", "秘钥权限有误"),
    HUOBI_KEY_ERROR("586", "传入的秘钥信息有误"),
    SPOT_NOT_ALLOW_TRADE("587", "当前现货账户有的持仓或挂单，无法下单,请手动清除该仓位"),
    INSERT_WALLET_ASSETS_FLOW_ERROR("589", "输入流水表失败"),
    QUAN_BOT_ALREADY_OPEN_ERROR("590", "该交易对已经开启了量化,请勿重复开仓"),
    QUAN_BOT_MUST_CLOSED("592", "请先关闭该交易对的机器人"),
    QUAN_BOT_HAD_SELLED("593", "该交易对已清仓,请勿重复清仓"),
    QUAN_BOT_OKEX_API_KEY_NOT_BIND("594", "请先绑定欧易ApiKey"),
    QUAN_BOT_HUO_BI_API_KEY_NOT_BIND("594", "请先绑定火币ApiKey"),
    QUAN_BOT_BINANCE_API_KEY_NOT_BIND("594", "请先绑定币安ApiKey"),
    QUAN_BOT_HUO_BI_API_KEY_VERIFY_ERROR("595", "火币ApiKey不正确或者无权限,请重新绑定"),
    QUAN_BOT_NOT_EXIST_ERROR("596", "尚为开启量化机器人"),
    MARKET_PRICE_REQUEST_ERROR("597", "请求行情数据失败，请检查网络"),
    SELL_AMOUNT_ERROR("598", "机器人抛售数量异常，已停止该机器人"),
    ADD_POSITION_ERROR("599", "补仓失败"),
    SINGLE_STRATEGY_ERROR("600", "单次循环结束,已止盈清仓,清除该机器人"),
    STOP_LOSSES_ERROR("601", "当前浮动盈亏已到达硬止损线,已触发硬止损"),
    BTC_CRASH_ERROR("602", "比特币崩盘，全部机器人斩仓出逃"),
    TIMES_MODEL_NOT_EXIST_ERROR("603", "不存在该种倍投模式"),
    EXCHANGE_TYPE_NOT_EXIST("604", "该交易所不存在"),
    QUANT_BOT_IN_LOCK("605", "该机器人正处于锁仓状态"),
    OPERATE_TYPE_ERROR("606", "操作类型错误"),
    QUANT_BOT_IN_UNLOCK("607", "该机器人正处于未锁仓状态"),
    LEVERATE_IN_USING("608", "正在使用的杠杆倍数和更新的杠杆倍数不一致,不能更新"),
    ROBOT_DIRECTION_NOT_EXIST("609", "多空方向参数错误,不存在该方向"),
    PROFIT_SHIFTING_FAIL("610", "转移利润失败"),
    RISK_RATE_QUERY_ERROR("611", "保证金率查询失败"),
    POSITION_NOT_EXIST("612", "您在交易所的账户中不存在该杠杆倍数和方向的交易对仓位"),
    ERROR_LEVERRATE("613", "该杠杆倍数不可用"),
    AVAILABLE_OPEN_AMOUNT_NOT_ENOUGH("614", "交易所可开数量不足"),
    GET_APPERPRICE_ERROR("615", "获取展示价格异常"),
    CHANGE_LEVERRATE_ERROR("616", "调整交易所杠杆倍数异常"),
    RATE_SPEED_TOO_FAST("617", "当前行情剧烈波动,触发止损!"),
    TOTAL_STOP_LOSS_NUM_LIMIT_ADD_NUM("618", "总体止损次数限制风控触发,自动清仓!"),
    GET_OFF_TIME_EXPIRE("619", "快进快出模式下,触发解套风控,自动清仓降低仓位!"),
    AVGPRICE_ERROR("620", "均价统计错误，出现了负数!"),
    TRADER_AMOUNT_CANT_SMALL_THAN_ZERO("620", "交易数量不能小于等于0");
    private String code;
    private String message;

    public static ResponseStatusEnum getEnum(String code) {
        for (ResponseStatusEnum ele : ResponseStatusEnum.values()) {
            if (ele.code.equals(code)) {
                return ele;
            }
        }
        return null;
    }

    /**
     * 构造方法
     *
     * @param code    错误码
     * @param message 错误消息
     */
    ResponseStatusEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * @return 返回成员变量值
     */
    public String getCode() {
        return code;
    }

    /**
     * @return 返回成员变量值
     */
    public String getMessage() {
        return message;
    }
}
